﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class EditPassword : System.Web.UI.Page

{
    string username;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["uid"] == null)
        {
            Response.Redirect("../GUI/Home.aspx");
        }
        else
            username = Session["uid"].ToString();
    }

    protected void btnChange_Click(object sender, EventArgs e)
    {
        string newpass = txtNewpass.Text;
        if (newpass.Length < 6 || newpass.Length > 18)
        {
            lblTB.Text = "Password must be between 6 and 18 characters";
            txtNewpass.Focus();
            return;
        }
        ToolsDT.UpdatePassword(username,newpass);
        lblTB.Text = "Password was changed!";
    }
}
